<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,user-scalable=no,initial-scale=1.0,maxinum=1.0,mininum=1.0">
    <meta http-equiv="X-UX-Compatible" content="ie=edge">
</head>
<body>
<input type="text" id="searchType"/><button th:onclick="search()">搜索</button></br>
<button th:onclick="insert()">添加商品</button>
<table border="1">
    <thead>
    <th>商品Id</th>
    <th>类型</th>
    <th>名称</th>
    <th>价格</th>
    <th>数量</th>
    <th>产地</th>
    <th>图片路径</th>
    <th>图片数量</th>
    <th>描述</th>
    <!--<th>创建时间</th>-->
    <th>折扣</th>
    <th>销量</th>
    <th>店铺Id</th>
    <th>购买等级</th>
    <th>是否删除</th>
    <th>操作</th>
    </thead>
    <tbody>
    <tr th:each="product: ${products}">
        <td th:text="${product.productId}"></td>
        <td th:text="${product.productType}"></td>
        <td th:text="${product.productName}"></td>
        <td th:text="${product.productPrice}"></td>
        <td th:text="${product.productNum}"></td>
        <td th:text="${product.productCity}"></td>
        <td th:text="${product.productPics}"></td>
        <td th:text="${product.productPicnum}"></td>
        <td th:text="${product.productDescription}"></td>
        <!--<td th:text="${product.productCreatetime}"></td>-->
        <td th:text="${product.productDiscount}"></td>
        <td th:text="${product.productSale}"></td>
        <td th:text="${product.storeId}"></td>
        <td th:text="${product.productClass}"></td>
        <td th:text="${product.productIsdel}"></td>
        <td><a th:href="'/update?id='+${product.productId}">修改</a>&nbsp;<a th:href="'/delete?id='+${product.productId}">删除</a></td>
    </tr>
    </tbody>
</table>
<script>
    function search() {
        var types=document.getElementById("searchType").value;
        console.log(types);
        window.location.href='/searchbyType?type='+types;
    }
    function insert() {
        window.location.href='/add';
    }
</script>
</body>
</html>